<template>
	<view>
		<view class="commentItem flex flexBei" v-for="(item, index) in list" :key="index">
			<image :src="item.hesd_portrait"></image>
			<view class="comment_content">
				<view class="title flex flexBei">
					<view class="name textHd">{{ item.name }}</view>
					<view class="time">{{ item.create_time.slice(0, 10) }}</view>
				</view>
				<view class="commentdetails textHd2">{{item.content || item.discuss_conent | emojoy}}</view>
			</view>
		</view>
		<view class="backTop" @click="backTop" v-show="(scrollTop > 300)">
			<u-icon size="40" name="arrow-upward"></u-icon>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				scrollTop: 0
			};
		},
		onPageScroll(e) {
		  this.scrollTop = e.scrollTop
		},
		props:{
			list: {
				type: Array,
				required: true,
				default() {
					return []
				}
			}
		},
		methods: {
			// 放回顶部
			backTop () {
				uni.pageScrollTo({
				scrollTop: 0, //距离页面顶部的距离
				duration: 300
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
.commentItem {
		padding: 18rpx 12rpx;
		border-bottom: 1rpx solid #fff;
		image {
			width: 90rpx;
			height: 90rpx;
			border-radius: 12rpx;
		}
		background-color: #fafafa;
		.comment_content {
			width: 590rpx;
			.name {
				width: 240rpx;
				padding-left: 12rpx;
			}
			.time {
				font-size: 22rpx;
				color: #999;
			}
			.commentdetails {
				margin-top: 4rpx;
				padding-left: 6rpx;
				text-indent: 2em;
				font-size: 20rpx;
			}
		}
	}
</style>
